package com.svms.data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;

import com.svms.service.factory.SvmsServiceFactory;
import com.svms.service.vo.IndentVO;
import com.svms.service.vo.SpareCodesVO;
import com.svms.service.vo.VehicleSpareVO;
import com.svms.service.vo.VehicleVO;

public class VehicleSparesData {

	public static List<VehicleSpareVO> getAllIndentInfo(int invoiceNumbe) {

		Random randomGenerator = new Random();

		List<VehicleSpareVO> vehicleSpareDataList = new ArrayList<VehicleSpareVO>();

		for (int i = 0; i < 3; i++) {
			VehicleSpareVO spareVO = new VehicleSpareVO();
			
			int hi = 130;
			int lo = 100;
			int id = (randomGenerator.nextInt(hi - lo) + lo);

			spareVO.setVehicleSpareId(String.valueOf(id));

			SpareCodesVO codesVO = new SpareCodesVO();
			codesVO.setSpareId(String.valueOf(id));
			codesVO.setSpareName("Tyres");

			spareVO.setSpareCodes(codesVO);
			spareVO.setInvoiceNumber(String.valueOf(invoiceNumbe));

			VehicleVO vehicle = new VehicleVO();
			vehicle.setVehicleId("163");

			spareVO.setVehicleVO(SvmsServiceFactory.getInstance().getVehicle()
					.getVehicle(vehicle));

			spareVO.setInstallationDate(new Date());
			spareVO.setDistanceTraveled("120");
			spareVO.setDaysTraveled("33");

			vehicleSpareDataList.add(spareVO);
		}
		System.out.println("**********");
		System.out.println(vehicleSpareDataList);
		System.out.println("**********");
		return vehicleSpareDataList;

	}
}
